// ❤ 渲染组件页面 
import React, { 
    Component,
    Suspense, //包在路由外面,担心路由懒加载出不来
 } from 'react'

import { Switch, Route } from 'react-router-dom';

export class RouterView extends Component {
  render() {
      const { routeConfig } = this.props;
    return (
        <Suspense fallback="路由加载中">
            <Switch>
                {
                   routeConfig.length?
                   routeConfig.map( (item,index) => {
                       return <Route 
                       key={index}
                       path={item.path}
                       component={item.component}
                       >
                       </Route>
                   }):"暂无路由页面" 
                }
            </Switch>
        </Suspense>
    )
  }
}

export default RouterView